home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
3D Images
/
3D Images.iso
/
programs
/
amiga
/
genesis
/
usingflexiparse
< prev
next >
Wrap
Text File
|
1995-02-09
|
15KB
|
502 lines
Spikey Boy!!
Here it is, a sort of 'beta quardruple minus' version of the infamous
FLEXIPARSE solid-modelling interpreter/parser!
Right, lets get down to the buisness with regards how to use it, what
it can do and what it can't do!
Firstly, lets get the 'How to use it bit' out the way. The parser is
invoked with the command:
1> flexiparse
from the CLI.
You shall then be confronted with some copyright crap and a MODULA-2 input
file request:
in> <filename>.csg
At the above request, you should type the filename followed by a .csg
extension. The CSG definition file for the model is then read in,
syntactically analysed, lexically analysed and finally code is generated in
your format (assuming you have no errors!!). Before the code-generation
phase is initiated, another requestor will appear:
out> <filename>
which will request you to type the name of the file to put the code that has
been generated in your format.
I've currently got a version of FLEXIPARSE lying on my desk that will do all
the above input file/output file stuff without requesting you to type the
names of the files in. That is, you can type: 1> flexiparse greektemple.csg
and it will automatically produce a greektemple.model file in your format
and dump it to disk. I'll send you this when I've added some more features
and thoroughly tested it!
Anyway, you can then GENESIS the resulting model file. Make sure you've
opened a screen first, as FLEXIPARSE doesn't automatically write an open
screen command to the output file.
Its probably, a good idea to incrementally test FlexiParse by doing simple
objects first and then getting more complex. I realise there are some bugs
in the program of which the known ones are documented at the end of this
file.
Good Luck! You'll need it...
FLEXIPARSE .CSG FILE FORMAT
===========================
FlexiParse basically accepts standard WINSOM model files with regards
overall syntactic structure. Briefly, this is explained below:
PRIMATIVES
----------
Primatives have the following syntax:
<Prim_Name> (<Argument1>,<Argument2>,...<ArgumentN>)
e.g. PLANE(0,1,0)
Remember, all arguments are seperated by commas.
The only exception to this is for primatives that don't take any
arguments e.g. EMPTY which does not need any brackets
e.g. EMPTY
All the primatives implemented on the version of GENESIS you last gave
me have been implemented in FlexiParse.
TRANSFORMS
----------
As per WINSOM format, Transforms can be used after primatives, macros or
expressions surrounded by parentheses.
e.g.
SPHERE(30) XROT(90)
or
DubiousLookingSausageShape XROT(180)
(Assuming DubiousLookingSausageShape has been defined as a macro)
or
(SPHERE(10) UNION SPHERE(20) AT(10,10,10)) YROT(270)
Finally, like WINSOM, there is no restriction on how many transforms can be
'chained' together in an expression:
e.g.
SPHERE(10) XROT(20) YROT(30) ZROT(40) SCALE(3) AT(10,10,10)
All the transforms that have been implemented in the version of GENESIS that
you gave me have been implemented in FlexiParse.
CSG OPERATORS
-------------
As per WINSOM format. CSG Operators can join primitives, macros and
complex expressions. FlexiParse supports the keywords:
UNION - Union
DIFF - Difference
INT - Intersection
e.g.
SPHERE(10) UNION SPHERE(20)
SPHERE(10) DIFF BigLongDanglyObject
(SPHERE(10) UNION SPHERE(20)) DIFF SPHERE(40) UNION (PLANE(0,1,0)
AT (20,20,20))
USE OF PARENTHESES
------------------
Like WINSOM, the priority of evaluation of expressions can be increased
by the dudicious use of the good old parentheses symbols:
(......)
e.g. This is performed in the below example to UNION the two SPHEREs
together BEFORE being chopped by the half-plane.
( SPHERE(10) UNION SPHERE(10) AT(10,0,0) ) DIFF PLANE(0,1,0)
COMMENTS
--------
Comments can be easily incorporated in the file by using my favourite
symbol: # (boy, I get so exited when I type it in!!)
The '#' symbol must surround the area to be commented:
e.g.
# Andy's Amazing FlexiParse Example! #
DRAW SPHERE(10) UNION SPHERE(10) AT(20,0,0);
This is quite useful for 'commenting' out bits of a model file during
development of a complex object! (Who says I don't put useful facilities in
my programs!!)
MACROS
------
Macro's provide the main power behind the flexiparse environment. They
work similarly to the way that WINSOM macros function, with one small
difference. WINSOM macros 'IMPLICITLY' assume that the macro is evaluated
when it is called:
e.g. /* A WINSOM program */
TWOSPHERES = SPHERE(10) UNION SPHERE(10) AT (10,0,0);
DRAW SPHERE(1) UNION TWOSPHERES UNION SPHERE(3);
In this example TWOSPHERES will be evaluated as if it were surrounded
by parentheses.
This is just the way FlexiParse works but for the fact the brackets
must surround the whole macro-definition:
e.g. # A much better way of doing things using flexiparse #
OBJECT = (SPHERE(10) UNION SPHERE(10) AT(10,0,0));
DRAW SPHERE(1) UNION OBJECT UNION SPHERE(3);
or alternatively,
OBJECT = SPHERE(10) UNION SPHERE(10) AT(10,0,0);
DRAW SPHERE(1) UNION (OBJECT) UNION SPHERE(3);
^
|
Macro call can alternatively be surrounded by
brackets
I feel that this way of defining macros is a bit more consistent, adds a bit
more flexibility and is easier to program and write good code!!
Also, macros can be nested within other macros to as many levels as you
like. (Good stuff eh!!)
STRUCTURE
---------
The structure roughly obeys the WINSOM file format:
Main Body Structure
-------------------
DRAW <Main Body> ;
.
The semi-colon and terminating full-stop must be included.
Macros
------
<Name> = <Macro Body> ;
The macro is terminated with a semi-colon.
Thats about it really!!!..
ERROR DETECTION
---------------
Probably, the most stable element in the system is the actual parser
which is used to analyse whether or not you've typed in a complete pile of
crap or a solid-modelling masterpiece!! There is one small problem at the
moment in that FlexiParse will tell you that you've got an error but won't
tell you where it is!!
e.g. # An Amateurs solid modelling attempt #
DRAW SPHERE(10) UNION ;
Obviously wrong as the sphere is being UNION'ed with nothing!
Flexiparse will respond with:
You have a Lexical Error Somewhere!!
Hmmm, A bit better than it not telling you I suppose!!
This will be updated soon (promise!!).
Right, lets now discuss the bad news with regards using FlexiParse:
1) Macro Names
-----------
(i) Macro Names must be less than 10 Characters Long.
(ii) Macro Names must not start with a subset of other macro names
or reserved words
e.g. MAC = SPHERE(3) UNION SPHERE(4);
MACSMACRO = SPHERE(10) UNION PLANE(0,1,0);
would cause MACSMACRO to be interpreted as MAC.
Naughty stuff!! But A Low priority bug-fix at the mo.
2) Macro Bodies
------------
Hmmm, this is probably the worst problem associated with FlexiParse
to date. The FlexiParse code-generator module often gets slightly confused
when the end of the macro is encountered and will often ignore any
transforms after an invocation of a macro.
e.g.
OHSHIT = SPHERE(10) UNION SPHERE(10) AT (10,0,0);
DRAW SPHERE(10) UNION PLANE(0,1,0) XROT(20) UNION
(OHSHIT) XROT(90) YROT(45);
^ ^
| |
These would be ignored and would not appear in the
output file!! (Extremely Naughty!)
To circumvent this, (Hurrah!!) if you add a dummy EMPTY at the end
of the macro definition, things seem to work!!
e.g.
OHSHIT = SPHERE(10) UNION SPHERE(10) AT (10,0,0) UNION EMPTY;
This is a High Priority bug-fix and depresses me totally as its
quite a difficult bug to fix. It might even facilitate the re-design of the
code-generator module.
Another thing you should not try is to call a macro from its own
definition:
e.g. YETAGAIN = SPHERE UNION (YETAGAIN);
You could be waiting a long time for this one to finish...
3) Program Size
------------
You might have noticed that flexiparse is quite a LARGE executable
file. This is due to a large chunk of Statically allocated memory being
reserved at compile time i.e. I'm using Arrays. The compiled code for the
program (neglecting Arrays,Variables etc..) is just over 17k and this should
not really go over 20k when my modifications have been made. In additions
this shall also then have all data-structures dynamically allocated!!
4) The Insidious Bastard Bug
-------------------------
The 'Insidious Bastard Bug' is quite odd and I'm not sure if it
really exists or is a bug at all!! The problem seems to lie with an
exception condition that occurs during code-generation and then **StRaNgE**
things start to happen e.g. Produces the wrong output when GENESISED.
This has only happened to me once and is likely to only happen
when using MACRO's. If you try out any files that don't work or produce the
wrong output then send them to me, in a stamped addressed envelope!!
5) The DRAW SPHERE(10) Bug
-----------------------
Flexiparse will not allow you to DRAW single primitives:
e.g. DRAW SPHERE(10);
It will probably come back with the FlexiParse Diagnostic message:
Synchronisation Error..
Although, as with most flexiparse bugs, it can be resolved with the
good old EMPTY statement:
DRAW SPHERE(10) UNION EMPTY;
This is probably all the bugs/bad-points I can think of at the moment.
THINGS REMAINING TO BE DUN
==========================
Well, there are a fair number of things:
1) Making Code-Generator Stable
----------------------------
This might require a complete rewrite of this module in order to make it
more efficient and to make it more robust.
2) Dynamic Allocation
------------------
A primary goal is to make all structures in FlexiParse dynamic. At the
moment 80% of them are, and they are very efficient in terms of memory
allocation/disposal.
3) Error Handler
-------------
It would be nice to have one wouldn't it ?? I mean, one that just
doesn't say if an error occurs but also pin-points it visually and also
comes up with a witty message or something!!
e.g. DRAW SPHERE(5) UNION ;
^
Flexi-Error #5 : Primitive/Expression/Macro Expected.
Optional Features I'd like incorporated:
4) Library Facilities
------------------
Yup, we've discussed this before. A major ability to IMPORT
macro's/objects from on-line disk libraries will be a great facility!
e.g.
GREEKTEMPLE = architecture/greektemple.csg
5) Constants
---------
I think the ability to define constants inside a CSG description file
would be most useful:
e.g.
ScaleFactor = 2;
DRAW ( SPHERE(10) UNION SPHERE(10) AT (20,0,0) ) SCALE(ScaleFactor);
This would increase the functionality of the parser almost to the stage
of a CSG language (e.g. ESME) without actually being one!!
What do you think??
FINALLY
=======
The major problems I foresee at the moment are:
1) Time
2) My Current State of Mind
I'm currently inundated with work at the moment which really pisses me
off as I can't do much on FlexiParse. Also, this leads to depression which
means that even when I do start doing some flexiparsing I feel guilty that
I'm not doing any work. This leads to me doing some work and feeling
depressed....(and so on!!).
It would be nice to know some reasonable time-scales in order to plan
around my work schedule.
MISCELLANEOUS
=============
I've recently applied to do the prestigious MA Computing in Design course
at Middlesex Poly after I finish my degree. This is a really brilliant
course and mixes computer-graphics, computer-animation , paintbox and
production skills. So if/when we team up to form our mega-company then I
think the skills I've picked up on this course will be an asset if we ever
decide to branch out to commercial animation etc..
Anyway, my final-year project is 'crawling' along. My specification is
now to design a surface-modeller for the graphic design department. The
skills I pick up during the project will be useful if we ever decide to
produce surface-modellers etc.. If you have any tips or good books on the
subject, then let me know. Also, do you know any good hidden-line removal
algorithms???
Also, It would be quite nice if you could send me some info regarding
which libraries/procs to import in order to set up screens,plot-points,
draw-lines etc. using the Benchmark Compiler. The RKM is particullarly vague
in places and I'm a lazy git so I can't be bothered reading it in order to
find out the system calls!! I realise you can either use the Rasters Module
or do it through Intuition. The easiest method would be great, as I'm
currently going through a bought of dyslexia! Anyway, the reason I need them
is to experiment on the Amiga with regards the surface-modeller I'm working
on!
I hope you think FlexiParse is at least Average and at the best quite
good, will hindsight I think if I had to start from scratch I would have
done things a bit differently!! At least you have an interface to the
modeller that is about 200% better than the original one!
Finally, give me a ring once you've had a bash at using it and if you
find any bugs (which you probably will!) then write 'em down and send them
to me! I have included some example .csg files on the disk which might be
useful!
Have Fun,
Mc
10/12/89
P.S. Have a Happy Crimble!! (Yo Ho Ho and all that rubbish!)